/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 九转苍翎
 * Date: 2025/8/6
 * Time: 21:29
 */
public class Solution {
    public int removeDuplicates(int[] nums) {
        int cur = 0;
        int curNext = cur + 1;
        while (curNext < nums.length) {
            if (nums[cur] == nums[curNext]) {
                curNext++;
            }else {
                nums[cur + 1] =  nums[curNext];
                curNext++;
                cur++;
            }
        }
        return cur + 1;
    }

    public static void main(String[] args) {
        Solution s = new Solution();
        System.out.println(s.removeDuplicates(new int[]{0, 0, 1, 1, 1, 2, 2, 3, 3, 4}));
    }
}
